<?php
declare (strict_types=1);

namespace app\console;
use extend\BridgeHttpclient;
use zhanshop\App;
use zhanshop\console\Command;
use zhanshop\console\Input;
use zhanshop\console\Output;
use zhanshop\client\Httpclient;

class Test extends Command
{

    public function configure()
    {
       $this->useDatabase();
    }

    /**
     * @param Input $input
     * @param Output $output
     * @return void[host] => marketing4.saomiaotu.com
     * [http_port] => 8280
     * [user] => _2F7RrzBE3Rv80MmHEgJZ7LgeLblCLNe6fNHBjhDn5LUzUkvovyUlrb8QzzNIr9rTY
     * [pwd] => Soe79XrULaevXcycPHuuBTJnJLFoWI11KSr_2FcDLALZNGOBESV95Q5JWiVpAhzC4b
     */
    public function execute(Input $input, Output $output)
    {
        $client = new BridgeHttpclient('root', 'QIQI@58555120');
        $client->setProxy('socks5', 'gs2');
        $data = $client->debug()->setTimeout(5000)->request('http://4.ipw.cn');
        print_r($data);
        return;
        /**
         * POST http://127.0.0.1:9000/ HTTP/1.1
         * host: 127.0.0.1:9000
         * connection: keep-alive
         * mcp-session-id: 77f369d6002944ae8e73cba5512d4c83
         * content-type: application/json
         * accept: application/json, text/event-stream
         * accept-language: *
         * sec-fetch-mode: cors
         * user-agent: node
         * accept-encoding: gzip, deflate
         * content-length: 196
         *
         * {"method":"tools/call","params":{"name":"get_format","arguments":{"file":"http://test-cdn.zhanshop.cn/202571/-3281133952.mp4","format":"mp3"},"_meta":{"progressToken":14}},"jsonrpc":"2.0","id":14}
         */
        $client = new Httpclient();
        $client->setHeader('content-type', 'application/json');
        $client->setHeader('mcp-session-id', '77f369d6002944ae8e73cba5512d4c83');
        $ok = $client->setTimeout(60000)->request('http://127.0.0.1:3000/mcp/', "POST", '{"method":"tools/call","params":{"name":"v1/ffmpeg.convert:POST","arguments":{"file":"http://test-cdn.zhanshop.cn/202571/-3281133952.mp4","format":"mp3"},"_meta":{"progressToken":19}},"jsonrpc":"2.0","id":19}');
        print_r($ok);
        print_r(json_decode($ok['body'], true));
        //        $config = [
//            'api' => [
//                'host' => 'http://192.168.1.7:11434/v1',
//                'key' => ''
//            ],
//            'config' => [
//                'model' => 'qwen3:8b',
//                'messages' => [
//                    [
//                        'role' => 'user',
//                        'content' => '帮我查询上海的天气预报和气温'
//                    ]
//                ],
//                'temperature' => 1,
//                'top_p' => 1,
//                'enable_thinking' => false,
//                'stream' => true,
//                'stream_options' => [
//                    'include_usage' => true
//                ],
//                'tools' => [
//                    [
//                        'function' => [
//                            'name' => "get_weather",
//                            'description' => "获取天气情况\n:param city: 城市\n:return: 城市天气情况的描述",
//                            'input_schema' => [
//                                'properties' => [
//                                    'city' => [
//                                        'title' => '城市',
//                                        'type' => 'string',
//                                    ]
//                                ],
//                                'required' => [
//                                    'city'
//                                ],
//                                'type' => 'object'
//                            ],
//                        ]
//                    ]
//                ]
//            ]
//        ];
//        $aichat = new Aichat($config);
//        $aichat->completions();
////        $config = \app\api\admin\v1\service\plugin\Storagetoken::qiniu('img');
////        $client = new Httpclient();
////        $client->httpproxy('marketing4.saomiaotu.com', 8280, 's3QeE8lQ0CinrkCOZBnBm6Jop9_2FVSL9dyIoGnWV1z1jUkvovyUlrb8QzzNIr9rTY', '6H3420mT07kEjGMIGqOjwW9WJSJq4rdGLrrSVHXwoDsusu9yDTc7BpmdA_2BVNiWZF');
////        $data = http_build_query([
////            //'url' => 'http://test-cdn.zhanshop.cn/2024428/171431054034911745.jpg',
////            'type' => 'url',
////        ]);
////        $ok = $client->request("http://www.sunkeycn.com", "POST", $data);
////        print_r($ok);die;
    }
}


// 小米 百度 荣耀 好了